#include <windows.h>
#include <iostream.h>
#include <fstream.h>

int main(int argc, char *argv[])
{
if (argc<3) {
 cout << "Usage: " << argv[0] << " [\\path\\to\\]config [\\path\\to\\]areas.bbs" << endl;
 return 1;
 }

char s[4096],bt[4096]="$",z[4096]="";
ifstream f(argv[1]);
if (!f) {
 cout << "Unable to open config" << endl;
 return 1;
 }
ofstream o(argv[2]);
if (!o) {
 cout << "Unable to write areas.bbs" << endl;
 return 1;
 }
while (f >> s) {
 if (stricmp(s,"EchoArea")==0) {
  if (strlen(z)>0) o << bt << z << endl;
  strcpy (bt,"$");
  strcpy (z,"");
  f >> s;
  strcpy (z,s);
  strcpy (s," ");
  strcat (s,z);
  strcpy (z,s);
  f >> s;
  strcat (s,z);
  strcpy (z,s);
  }
 if (stricmp(s,"-b")==0) {
  f >> s;
  if (stricmp(s,"jam")==0) strcpy (bt,"!");
  if (stricmp(s,"squish")==0) strcpy (bt,"$");
  if (stricmp(s,"msg")==0) strcpy (bt,"");
  }
 }
return 0;
}
